require 'rake/testtask'
require 'rake/rdoctask'


task :default => [:compile]
task :test => ["test.rb"] do |t|
    system %(ruby test.rb)
end
task :compile => ["alglib.so"]

file "alglib/alglib.cpp"=>Dir.glob("*.i") do |t|
    puts "Reconstruyendo swig"
	system %(swig -fvirtual -Wall -c++ -o alglib/alglib.cpp -ruby alglib.i)
end


cpp=Dir.glob("alglib/*.cpp")+Dir.glob("alglib/*.h")
file "alglib.so"=>cpp + ["Makefile"] do |t|
	system %(make)
end

file "Makefile" => ["extconf.rb"] do |t|
	system %(ruby extconf.rb)
end
